package com.appspot.zcmjqm.app.model.category;

import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Transient;

import com.appspot.zcmjqm.app.model.Consult;
import com.google.appengine.api.datastore.Key;
import com.google.appengine.api.datastore.KeyFactory;

@Entity
public class ConsultingCategory {

	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	private Key key;
	private String title;
	@OneToMany(mappedBy="consultingCategory", cascade=CascadeType.ALL)
	private List<Consult> consults;
	
	public Key getKey() {
		return key;
	}
	public void setKey(Key key) {
		this.key = key;
	}
	@Transient
	public String getKeyString() {
		return KeyFactory.keyToString(key);
	}
	public String getTitle() {
		return title;
	}
	public void setTitle(String title) {
		this.title = title;
	}
	public List<Consult> getConsults() {
		return consults;
	}
	public void setConsults(List<Consult> consults) {
		this.consults = consults;
	}
	
}
